/*
 * Copyright (c) Jack魏 2023 - 2023 , All Rights Reserved.
 */

package cn.jackwei.yiyi.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * 应用配置
 *
 * @author Jack魏
 * @since 2023/10/20
 */
@Slf4j
@Component
public class AppConfig {
    /**
     * 服务器的HTTP端口
     */
    @Value("${server.port}")
    public String port;

    /**
     * 应用的访问路径
     */
    @Value("${server.servlet.context-path}")
    public String path;

    /**
     * 文件保存的路径
     */
    @Value("${yiyi.file.path}")
    public String filePath;

    /**
     * 常用本地文件路径
     */
    @Value("${yiyi.file.local.path}")
    public String localPath;

    /**
     * 设置系统配置
     */
    @Bean
    public void setSystemProperty() {
        System.setProperty("server.port", port);
        System.setProperty("server.servlet.context-path", path);
        System.setProperty("yiyi.file.path", filePath);
        System.setProperty("yiyi.file.local.path", localPath);
    }
}
